#ifndef	_LOAD_H
#define	_LOAD_H

#include	"public.h"

/********************************************************
** Listed structures are used to load the table_structure and
** column_structure.
********************************************************/

typedef struct	_table_info
{
	int		table_id;
	short		app_no;
	short		column_num;
	char		table_name_eng[MAX_TABLE_NAME_ENG_LEN];
	char		table_name_chn[MAX_TABLE_NAME_CHN_LEN];
	short		record_length;
	int		record_num;
	int		max_record_num;
	unsigned char	is_auto_generate;
	unsigned char	is_record_app;
}	TABLE_INFO;

typedef	struct	_column_info {
	short		column_id;
	char		column_name_eng[MAX_COLUMN_NAME_ENG_LEN];
	char		column_name_chn[MAX_COLUMN_NAME_CHN_LEN];
	short		data_length;
	unsigned char	data_type;
	unsigned char	allow_null;
	unsigned char	is_display;
	unsigned char	display_type;
	short		display_length;	
	unsigned char	display_precision;
	char		menu_name[20];
	unsigned char	reference_flag;
	unsigned char	is_key;
	unsigned char	is_index;
	unsigned char	sort_order_no;
	unsigned char	reference_display;
	unsigned char	is_input;
	unsigned char	is_fix;
	char		init_value[8];
	char		min_value[8];
	char		max_value[8];
	int		reference_table;
	short		reference_column;
	unsigned char	column_special;
}	COLUMN_INFO;

/*
typedef struct	_column_data
{
	OCIDefine	*dfnp;
	sb2		indicator;
	unsigned char	unsigned_value;
	short		short_value;
	int		int_value;
	float		float_value;
	double		double_value;
	OCIDate		date_value;
	unsigned char	*bin_value;
	char		*string_value;
	sb4		valuelen;
	ub2		act_len;
}	COLUMN_DATA;
*/

/** function prototypes **/

extern int get_query_result (
        char            *query_string,
        unsigned char   what_null_means,
        char            **result_link,
        int             max_results = -1
);
extern int load_table (
        int             table_id,
        short           app_type,
        char            **load_result_link,
        int             *load_result_length,
        char            **message_string
);
extern int get_query_head (
        char            *result_link,
        RESULT_HEAD2    **result_head,
        FIELD_INFO      **field_info
);
extern int get_binary_length (
        char            *table_name,
        char            *column_name,
        char            *where_str
);


extern void init_result_link (
	int		result_size,
	short		end_flag,
	short		frame_no,
	short		result_no,
	short		error_no,
	int		table_id,
	short		app_no,
	char		**result_link
);
extern void print_result (
	char		*result_link
);

#endif
